#include <iostream>
#include <algorithm>
#define N 100

using namespace std;

int new_array(float array_a[], float array_b[],float array_c[],int elements){
int i;
float array_d[N];

for(i=0;i<elements;i++){
    array_d[i]=max(max(array_a[i],array_b[i]),array_c[i]); //used max from algorithm
    }

for(i=0;i<elements;i++)
cout<<array_d[i]<<" ";

}

void readintVector_A(float array_a[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array_a[i];
	cout<<"\n";}
}

void readintVector_B(float array_b[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array_b[i];
	cout<<"\n";}
}

void readintVector_C(float array_c[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array_c[i];
	cout<<"\n";}
}

int main(){
float array_a[N];
float array_b[N];
float array_c[N];
int elements;


cout<<"Type the number of elements you want in the both arrays: ";
cin>>elements;

cout<<"Array A:"<<endl;
readintVector_A(array_a, elements);
cout<<"Array B:"<<endl;
readintVector_B(array_b, elements);
cout<<"Array C:"<<endl;
readintVector_C(array_c, elements);

cout<<"The original array A is ";
for(int i=0; i<elements; i++){
	cout<<array_a[i]<<" ";}
cout<<endl;

cout<<"The original array B is ";
for(int i=0; i<elements; i++){
	cout<<array_b[i]<<" ";}
cout<<endl;

cout<<"The original array C is ";
for(int i=0; i<elements; i++){
	cout<<array_c[i]<<" ";}
cout<<endl;


cout<<"The final array D is: "<<endl;
new_array(array_a, array_b,array_c, elements);


return 0;
}
